
import request from "@/utils/request";

// 分类列表
export const getImageClass = (page) => {
  return request({
    url: `/image_class/${page}?limit=10`,
    method: "get",
  });
};
// 添加图库分类 image_class POST
export const addImgClass = (data) => {
  return request({
    url: `/image_class`,
    method: "post",
    data
  });
};
// 修改图库分类 image_class/:id {id,name，order} POST
export const editImageClass = (id,data) => {
  return request({
    url: `/image_class/${id}`,
    method: "post",
    data
  });
};
// 删除图库分类 image_class/:id/delete
export const delImageClass = (id) => {
  return request({
    url: `/image_class/${id}/delete`,
    method: "post",
  });
};
// 图库列表 /image_class/:id/image/:page?limit=10 GET

export const getImageList = (id,page) => {
  return request({
    url: `/image_class/${id}/image/${page}?limit=10`,
    method: "GET",
  });
};
// 添加图片  http://ceshi13.dishait.cn/admin/image/upload
export const addImage = (id,page) => {
  return request({
    url: `/image_class/${id}/image/${page}?limit=10`,
    method: "GET",
  });
};
// 修改图片名称 image/:id
export const editImageName = (id,data) => {
  return request({
    url: `image/${id}`,
    method: "post",
    data
  });
};

// 删除图片 传递id数组
export const delImage = (data) => {
  return request({
    url: `/image/delete_all`,
    method: "post",
    data
  });
};

// 上传图片
export const uploadImageAction = import.meta.env.VITE_APP_BASE_API + "/image/upload"
